<?php
header("Content-type: text/html; charset=utf-8"); 
require('../../../config.php');
require('../../../customer_id_decrypt.php'); //导入文件,获取customer_id_en[加密的customer_id]以及customer_id[已解密]
require('../../../common/utility_shop.php');
$link = mysql_connect(DB_HOST,DB_USER,DB_PWD);
mysql_select_db(DB_NAME) or die('Could not select database');

$user_id   =  $configutil->splash_new($_POST["user_id"]);
$new_role   =  $configutil->splash_new($_POST["new_role"]);

$sql = "select isAgent from promoters where user_id=".$user_id." and isvalid=true and customer_id=".$customer_id;

$result = _mysql_query($sql);

while($row = mysql_fetch_object($result)){
	$isAgent = $row->isAgent;
}

$arr = array();
switch($isAgent){
/*	case 1:
		$arr = array('3,5,6,7,8');
		$isin = in_array($new_role,$arr);
		if($isin){
			echo 1;
		}else{
			echo 0;
		}
		break;
	case 3:
		$arr = array('1,5,6,7,8');
		$isin = in_array($new_role,$arr);
		if($isin){
			echo 1;
		}else{
			echo 0;
		}
		break;
*/	case 5:case 6:case 7:case 8:
		$arr = array('1,3');
		$isin = in_array($new_role,$arr);
		if($isin){
			echo 1;
		}else{
			echo 0;
		}
		break;
}
?>